<div class="bg-light lter b-b wrapper-md">
    <h4 class="m-n font-thin">公告管理</h4>
</div>
<div class="wrapper-md ng-scope">
    <div class="panel panel-default" ng-controller="noticeCtrl">
        <div class="row wrapper">
            <div class="col-sm-3 pull-right">
                <div class="pull-right">
                    <a class="btn btn-sm btn-info" ui-sref="app.noticeAdd" target="_blank">添加公告</a>
                </div>
            </div>
            <div class="clearfix"></div>
        </div>
        <div class="table-responsive">
            <table class="table table-striped b-t b-light" style="margin: 0;">
                <thead>
                <tr>
                    <th width="40%">内容</th>
                    <th>标题</th>
                    <th>发布人</th>
                    <th>发布账号</th>
                    <th>标签</th>
                    <th>截止时间</th>
                    <th>状态</th>
                    <th width="200" class="text-center">操作</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="n in list">
                    <td>{{n.content|textLengthSet:true:100:'...'}}</td>
                    <td>{{n.name}}</td>
                    <td>{{n.issuerName}}</td>
                    <td>{{n.mobilePhone}}</td>
                    <td>
                        <label class="label bg-info" ng-if='n.isShop==1'>商户</label>
                        <label class="label bg-danger" ng-if='n.isApi==1'>小程序</label>
                        <label class="label bg-success" ng-if='n.isCity==1'>城市中心</label>
                        <label class="label bg-primary" ng-if='n.isShop==0&&n.isCity==0&&n.isApi==0'>总部专属</label>
                    </td>
                    <td>{{n.endTime}}</td>
                    <td>
                        <label class="label bg-danger" ng-if='n.status==2'>已失效</label>
                        <label class="label label-default" ng-if='n.status==1'>未启用</label>
                        <label class="label bg-light" ng-if='n.status==0'>已启用</label>
                    </td>
                    <td class="t-btns text-center" >
                        <a ui-sref="app.noticeDetail({id:n.id})" class="btn btn-sm btn-success" target="_blank">查看</a>
                        <a ng-if='n.status!=2' ui-sref="app.noticeEdit({id:n.id})" class="btn btn-sm btn-info" target="_blank">修改</a>
                        <button ng-if='n.status==2' ng-click="openDelete(n.id,n.name)" class="btn btn-sm btn-danger">删除</button>
                        <div class="btn-group dropdown" dropdown=""  ng-if='n.status!=2'>
                            <button class="btn btn-sm btn-default" dropdown-toggle="" aria-haspopup="true" aria-expanded="false">更多 <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu">
                                <li><a href="" ng-click="toTop(n.id)">置顶</a></li>
                                <li class="divider"></li>
                                <li ng-if='n.status==1'><a href="" ng-click="changeStatus(n.id)">启用</a></li>
                                <li ng-if='n.status==0'><a href="" ng-click="changeStatus(n.id)">禁用</a></li>
                                <li class="divider"></li>
                                <li><a href="" ng-click="makeFailure(n.id)">失效</a></li>
                                <li class="divider"></li>
                                <li><a href="" ng-click="openDelete(n.id,n.name)">删除</a></li>
                            </ul>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <footer class="panel-footer">
            <div class="row">
                <div class="col-sm-4 hidden-xs">
                </div>
                <div class="col-sm-4 text-center">
                    <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                </div>
                <div class="col-sm-4 text-right text-center-xs">
                    <pagination boundary-links="true" total-items="totalItems" ng-model="currentPage"
                                ng-change="pageChanged()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                previous-text="上一页" next-text="下一页"
                                first-text="首页" last-text="尾页"></pagination>
                </div>
            </div>
        </footer>
    </div>
</div>